#include<iostream>
using namespace std;
int main()
{
	int t;
	cin >> t;
	while (t--)
	{
		int a, b;
		cin >> a >> b;
		if (a == 10 && b == 21) {
			cout << "It's today!!" << endl;
		}
		else if (a > 10 || (a == 10) && (b > 21)) {
			cout << "What a pity, it has passed!" << endl;
		}
		else {
			int month[11] = { 0,31,28,31,30,31,30,31,31,30,21};
			if (a == 10) {
				cout << 21 - b << endl;
			}
			else {
				int sum = 0;
				for (int i = a; i < 11; i++)
				{
					sum += month[i];
				}
				cout << sum - b<< endl;
			}
		}
	}
	return 0;
}